package com.minazuki.signinserver.pojo.dao;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.hibernate.validator.constraints.Length;

import javax.persistence.Id;
import javax.validation.constraints.NotNull;
import java.util.Date;

public class User {
    public User() {
    }

    public User(String username) {
        this.username = username;
    }

    @Id
    private Integer id;
    @Length(min = 3, max = 30, message = "用户名只能在4~30位之间")
    @NotNull
    private String username;
    @NotNull
    @Length(min = 6, max = 30, message = "密码要大于6位")
    private String password;
    @JsonIgnore
    private String salt;// 密码的盐值
    private Date created;// 创建时间

    public Date getCreated() {
        return created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
}
